package com.tcm.order.domain.enums;

/**
 * Created by rize on 2019/2/13.
 */
public enum TradeTypeEnum {
    ORDER_PAY("ORDER_PAY", "订单支付"),
    CHARGE_PAY("CHARGE_PAY", "充值支付")
    ;

    TradeTypeEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    private final String code;

    private final String msg;

    public String getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public static String getValue(String value) {
        TradeTypeEnum[] tradeTypeEnums = values();
        for (TradeTypeEnum tradeTypeEnum : tradeTypeEnums) {
            if (tradeTypeEnum.getCode().equals(value)) {
                return tradeTypeEnum.getCode();
            }
        }
        return null;
    }

    public static String getDesc(String value) {
        TradeTypeEnum[] tradeTypeEnums = values();
        for (TradeTypeEnum tradeTypeEnum : tradeTypeEnums) {
            if (tradeTypeEnum.getCode().equals(value)) {
                return tradeTypeEnum.getMsg();
            }
        }
        return null;
    }

}
